|
color21 2.2.0
|
API for configuring and manipulating Color 21 Click driver. More...
Topics | |
| Color 21 Registers List | |
| List of registers of Color 21 Click driver. | |
| Color 21 Registers Settings | |
| Settings for registers of Color 21 Click driver. | |
| Color 21 MikroBUS Map | |
| MikroBUS pin mapping of Color 21 Click driver. | |
Functions | |
| void | color21_cfg_setup (color21_cfg_t *cfg) |
| Color 21 configuration object setup function. | |
| err_t | color21_init (color21_t *ctx, color21_cfg_t *cfg) |
| Color 21 initialization function. | |
| err_t | color21_default_cfg (color21_t *ctx) |
| Color 21 default configuration function. | |
| err_t | color21_generic_write (color21_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| Color 21 I2C writing function. | |
| err_t | color21_generic_read (color21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| Color 21 I2C reading function. | |
| err_t | color21_write_reg (color21_t *ctx, uint8_t reg, uint8_t data_in) |
| Color 21 write register function. | |
| err_t | color21_read_reg (color21_t *ctx, uint8_t reg, uint8_t *data_out) |
| Color 21 read register function. | |
| err_t | color21_write_reg_word (color21_t *ctx, uint8_t reg, uint16_t data_in) |
| Color 21 write register word function. | |
| err_t | color21_read_reg_word (color21_t *ctx, uint8_t reg, uint16_t *data_out) |
| Color 21 read register word function. | |
| err_t | color21_check_communication (color21_t *ctx) |
| Color 21 check communication function. | |
| void | color21_set_ldr_pin (color21_t *ctx, uint8_t state) |
| Color 21 set ldr pin function. | |
| uint8_t | color21_get_int_pin (color21_t *ctx) |
| Color 21 get int pin function. | |
| uint8_t | color21_get_io_pin (color21_t *ctx) |
| Color 21 get io pin function. | |
| err_t | color21_set_reg_bank_access (color21_t *ctx, uint8_t reg_bank) |
| Color 21 set reg bank access function. | |
| err_t | color21_disable_ext_led (color21_t *ctx) |
| Color 21 disable ext led function. | |
| err_t | color21_enable_ext_led (color21_t *ctx, uint16_t led_curr) |
| Color 21 enable ext led function. | |
| err_t | color21_set_integration_time_ms (color21_t *ctx, float int_time_ms) |
| Color 21 set integration time ms function. | |
| err_t | color21_set_wait_time_ms (color21_t *ctx, float wait_time_ms) |
| Color 21 set wait time ms function. | |
| err_t | color21_read_data (color21_t *ctx, color21_data_t *data_out) |
| Color 21 read data function. | |
API for configuring and manipulating Color 21 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void color21_cfg_setup | ( | color21_cfg_t * | cfg | ) |
Color 21 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See color21_cfg_t object definition for detailed explanation. |
| err_t color21_check_communication | ( | color21_t * | ctx | ) |
Color 21 check communication function.
This function checks the communication by reading and verifying the device ID.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_default_cfg | ( | color21_t * | ctx | ) |
Color 21 default configuration function.
This function executes a default configuration of Color 21 Click board.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_disable_ext_led | ( | color21_t * | ctx | ) |
Color 21 disable ext led function.
This function disables the onboard LED.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_enable_ext_led | ( | color21_t * | ctx, |
| uint16_t | led_curr ) |
Color 21 enable ext led function.
This function enables the onboard LED with the selected led driver current.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | led_curr | : LED Driver current in mA [4-258]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_generic_read | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
Color 21 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Output read data. |
| [in] | len | : Number of bytes to be read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_generic_write | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
Color 21 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [in] | data_in | : Data to be written. |
| [in] | len | : Number of bytes to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | uint8_t color21_get_int_pin | ( | color21_t * | ctx | ) |
Color 21 get int pin function.
This function returns the INT pin logic state.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| uint8_t color21_get_io_pin | ( | color21_t * | ctx | ) |
Color 21 get io pin function.
This function returns the IO pin logic state.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| err_t color21_init | ( | color21_t * | ctx, |
| color21_cfg_t * | cfg ) |
Color 21 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See color21_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_read_data | ( | color21_t * | ctx, |
| color21_data_t * | data_out ) |
Color 21 read data function.
This function checks if the spectral measurement data is ready and then reads data from all channels along with the STATUS and ASTATUS bytes.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [out] | data_out | : Spectral measurements data object. See color21_data_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_read_reg | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
Color 21 read register function.
This function reads data from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Output read data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_read_reg_word | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint16_t * | data_out ) |
Color 21 read register word function.
This function reads a data word starting from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Output read data word. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_set_integration_time_ms | ( | color21_t * | ctx, |
| float | int_time_ms ) |
Color 21 set integration time ms function.
This function sets the integration time in milliseconds by setting the ATIME and ASTEP registers.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | int_time_ms | : Integration time in milliseconds [from COLOR21_INTEGRATION_TIME_MIN to COLOR21_INTEGRATION_TIME_MAX]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void color21_set_ldr_pin | ( | color21_t * | ctx, |
| uint8_t | state ) |
Color 21 set ldr pin function.
This function sets the LDR pin logic state.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | state | : Pin logic state. |
| err_t color21_set_reg_bank_access | ( | color21_t * | ctx, |
| uint8_t | reg_bank ) |
Color 21 set reg bank access function.
This function sets the register bank access.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg_bank | :
|
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_set_wait_time_ms | ( | color21_t * | ctx, |
| float | wait_time_ms ) |
Color 21 set wait time ms function.
This function sets the wait time in milliseconds by setting the WTIME register.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | wait_time_ms | : Wait time in milliseconds [from COLOR21_WAIT_TIME_MIN to COLOR21_WAIT_TIME_MAX]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_write_reg | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
Color 21 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t color21_write_reg_word | ( | color21_t * | ctx, |
| uint8_t | reg, | ||
| uint16_t | data_in ) |
Color 21 write register word function.
This function writes a data word starting from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See color21_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [in] | data_in | : Data word to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.